int _m_a_s_k (in) Conditions under which _p_r_o_c should
be called: OR-ed combination of
TTTTKKKK____RRRREEEEAAAADDDDAAAABBBBLLLLEEEE, TTTTKKKK____WWWWRRRRIIIITTTTAAAABBBBLLLLEEEE, and
TTTTKKKK____EEEEXXXXCCCCEEEEPPPPTTTTIIIIOOOONNNN.
Tk_FileProc *_p_r_o_c (in) Procedure to invoke whenever the
file or device indicated by _i_d meets
the conditions specified by _m_a_s_k.
Tk_FileProc2 *_p_r_o_c_2 (in) Procedure to invoke from event loop
to check whether _f_d is ready and, if
so, handle it.
ClientData _c_l_i_e_n_t_D_a_t_a (in) Arbitrary one-word value to pass to
_p_r_o_c.
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr arranges for _p_r_o_c to be invoked in the future
whenever I/O becomes possible on a file or an exceptional condition
exists for the file. The file is indicated by _i_d, and the conditions of
interest are indicated by _m_a_s_k. For example, if _m_a_s_k is TTTTKKKK____RRRREEEEAAAADDDDAAAABBBBLLLLEEEE,
_p_r_o_c will be called when the file is readable. The callback to _p_r_o_c is
made by TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt, so TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr is only useful in programs
that dispatch events through TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt or through other Tk procedures
that call TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt, such as TTTTkkkk____MMMMaaaaiiiinnnnLLLLoooooooopppp.
_P_r_o_c should have arguments and result that match the type TTTTkkkk____FFFFiiiilllleeeePPPPrrrroooocccc:
typedef void Tk_FileProc(
ClientData _c_l_i_e_n_t_D_a_t_a,
int _m_a_s_k);
The _c_l_i_e_n_t_D_a_t_a parameter to _p_r_o_c is a copy of the _c_l_i_e_n_t_D_a_t_a argument
given to TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr when the callback was created. Typically,
_c_l_i_e_n_t_D_a_t_a points to a data structure containing application-specific
information about the file. _M_a_s_k is an integer mask indicating which of
the requested conditions actually exists for the file; it will contain a
subset of the bits in the _m_a_s_k argument to TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr.
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr2222 also creates a file handler, but it provides a |
lower-level and more flexible interface. The callback procedure _p_r_o_c_2 |
must have arguments and result that match the following prototype: |
typedef int Tk_FileProc2( |
ClientData _c_l_i_e_n_t_D_a_t_a, |
int _m_a_s_k, |
int _f_l_a_g_s); |
Whereas a file handler created by TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr is only invoked |
when the file is known to be ``ready'', a file handler created by |
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr2222 is invoked on every pass through the the event loop|
(TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee); it gets to determine whether the file is ``ready'' or |
not. The _m_a_s_k argument contains an OR'ed combination of the bits |
TTTTKKKK____RRRREEEEAAAADDDDAAAABBBBLLLLEEEE, TTTTKKKK____WWWWRRRRIIIITTTTAAAABBBBLLLLEEEE, and TTTTKKKK____EEEEXXXXCCCCEEEEPPPPTTTTIIIIOOOONNNN, which indicate whether the |
file is known to be readable, writable, or to have an exceptional |
condition present (this is the case if sssseeeelllleeeecccctttt has been invoked since the |
previous call to _p_r_o_c_2, and if it indicated that the specified conditions|
were present). _p_r_o_c_2 may use this information along with additional |
information of its own, such as knowledge about buffered data, to decide |
whether the file is really ``ready''. The _f_l_a_g_s argument is a copy of |
the flags passed to TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt, which may be used by _p_r_o_c_2 to ignore |
the file if the appropriate bit, such as TTTTKKKK____FFFFIIIILLLLEEEE____EEEEVVVVEEEENNNNTTTTSSSS, is not present. |
_p_r_o_c_2 must return an integer value that is either TTTTKKKK____FFFFIIIILLLLEEEE____HHHHAAAANNNNDDDDLLLLEEEEDDDD or an |
OR-ed combination of TTTTKKKK____RRRREEEEAAAADDDDAAAABBBBLLLLEEEE, TTTTKKKK____WWWWRRRRIIIITTTTAAAABBBBLLLLEEEE, and TTTTKKKK____EEEEXXXXCCCCEEEEPPPPTTTTIIIIOOOONNNN. If the |
return value is TTTTKKKK____FFFFIIIILLLLEEEE____HHHHAAAANNNNDDDDLLLLEEEEDDDD it means that the file was ``ready'' and |
that _p_r_o_c_2 handled the ready condition; TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt will return |
immediately. If the return value is not TTTTKKKK____FFFFIIIILLLLEEEE____HHHHAAAANNNNDDDDLLLLEEEEDDDD, then it |
indicates the set of conditions that should be checked for the file if |
the current invocation of TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee invokes sssseeeelllleeeecccctttt. Typically the |
return value reflects all of the conditions that _p_r_o_c_2 cares about. A |
zero return value means that the file should be ignored if TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee |
calls sssseeeelllleeeecccctttt (this could happen, for example, if the _f_l_a_g_s argument |
specified that this file's events should be ignored). The value returned|
by _p_r_o_c_2 only affects a sssseeeelllleeeecccctttt call from the current invocation of |
TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt; the next invocation of TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt will call _p_r_o_c_2 |
afresh to get new information.
There may exist only one handler for a given file at a given time. If
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr or TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr2222 is called when a handler
already exists for _i_d, then the new callback replaces the information
that was previously recorded.
TTTTkkkk____DDDDeeeelllleeeetttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr may be called to delete the file handler for _i_d; if
no handler exists for the file given by _i_d then the procedure has no